<template>
	<view>
		<uni-nav-bar dark :fixed="true" shadow background-color="#00aaff" status-bar left-icon="left" title="账簿信息" @clickLeft="back"/>
		<view v-if="bank_account_info !== ''">
			<uni-list>
				<uni-list-item title="户号:" :rightText="bank_account_info.account_no" />
				<uni-list-item title="户名:" :rightText="bank_account_info.account_name" />
				<uni-list-item title="类型:" :rightText="bank_account_info.account_property == '1' ? '个人账户' : '企业账户'" />
				<uni-list-item title="开户日期:" :rightText="bank_account_info.created_at" />
				<template v-if="bank_account_info.account_property == '1'">
					<uni-list-item title="姓名:" :rightText="bank_account_info.id_name" />
					<uni-list-item title="证件号:" :rightText="bank_account_info.id_no" />
					<uni-list-item title="性别:" :rightText="bank_account_info.sex == '0' ? '男' : (bank_account_info.sex == '1') ? '女' : '保密'" />
					<uni-list-item title="民族:" :rightText="bank_account_info.ethnic" />
					<uni-list-item title="证件地址:" :note="bank_account_info.id_address" />
					<uni-list-item title="证件有效期:" :rightText="bank_account_info.id_start_date + '至' + bank_account_info.id_end_date" />
					<uni-list-item title="签发机关:" :rightText="bank_account_info.sign_name" />
					<uni-list-item title="联系电话:" :rightText="bank_account_info.mobile" />
				</template>
				<template v-else>
					<uni-list-item title="公司名称:" :rightText="bank_account_info.account_name" />
					<uni-list-item title="营业执照:" :rightText="bank_account_info.id_no" />
					<uni-list-item title="证件地址:" :note="bank_account_info.id_address" />
					<uni-list-item title="法人姓名:" :rightText="bank_account_info.company_id_name" />
					<uni-list-item title="法人证件:" :rightText="bank_account_info.company_id_no" />
					<uni-list-item title="实控人姓名:" :rightText="bank_account_info.controller_id_name" />
					<uni-list-item title="实控人证件:" :rightText="bank_account_info.controller_id_no" />
					<uni-list-item title="受益人姓名:" :rightText="bank_account_info.bene_name" />
					<uni-list-item title="受益人证件:" :rightText="bank_account_info.bene_id_no" />
				</template>
			</uni-list>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bank_account_info : ""
			}
		},
		
		onShow() {
			let uid = uni.getStorageSync('uid');
			
			if(!uid || uid == "") {
				uni.navigateTo({
					url: '/pages/login/index'
				})
			} else {
				this.getBankAccountInfo(uid)
			}
		},
		
		methods: {
			back() {
				uni.navigateTo({
					url: '/pages/index/index'
				})
			},
			
			getBankAccountInfo(uid) {
				uni.request({
					url: '/account/getBankAccountInfo',
					data: {
						uid
					},
					success: (res) => {
						if(res.data.success) {
							this.bank_account_info = res.data.data
						} else {
							uni.showToast({
								icon: 'error',
								title: res.data.errMessage
							})
						}
					}
				})
			}
		}
	}
</script>

<style>
</style>